package org.niux.aims.common.web;

import java.util.TimerTask;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.niux.aims.dao.ILogsDAO;

/**
 * 
 * Copyright (c) 2007,中企动力华南研发中心<br>
 * All rights reserved.<br>
 * 
 * 文件名称：KeepDBConnectionTimer.java<br>
 * 摘 要：继承TIMER类的定时器<br>
 * <br>
 * 当前版本：<br>
 * 作 者：梁铭显 Email: <a
 * href="mailto:liangmingxian@gmail.com">liangmingxian@gmail.com</a><br>
 * 完成日期：@since Aug 25, 2008<br>
 * <br>
 * 取代版本：<br>
 * 原作者 ：<br>
 * 完成日期：@since Aug 25, 2008<br>
 */
public class KeepDBConnectionTimer extends TimerTask {

	Log log = LogFactory.getLog(KeepDBConnectionTimer.class);
	
	private ILogsDAO logsDao;
	
	private static KeepDBConnectionTimer keepDBConnectionTimer = null;

	private KeepDBConnectionTimer(ILogsDAO logsDao) {
		this.logsDao = logsDao;
	}

	public static KeepDBConnectionTimer getKeepDBConnectionTimer(ILogsDAO logsDao) {
		if (keepDBConnectionTimer == null) {
			keepDBConnectionTimer = new KeepDBConnectionTimer(logsDao);
		}
		return keepDBConnectionTimer;
	}

	@Override
	public void run() {
		log.debug("共有========>" + logsDao.findById(1));
		log.info("Keep DataBase Connection!!!!");
	}

}
